﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;

namespace ServerFramework.DependencyInjection
{
    public sealed class IoC
    {
        private IoC() { }

        public static IoC Current
        {
            get
            {
                return Nested.Instance;
            }
        }
        private IUnityContainer container;
        public IUnityContainer Container
        {
            get
            {
                if (this.container == null)
                {
                    this.container = new UnityContainer();
                }
                return this.container;
            }
        }

        private class Nested
        {
            static Nested() { }

            internal static readonly IoC Instance = new IoC();
        }
    }

}
